home *** CD-ROM | disk | FTP | other *** search
- property pBegin, pEnd, pDur, pCount, pmode, spriteNum
-
- on beginSprite me
- pBegin = float(pBegin) / 100 * 255
- pEnd = float(pEnd) / 100 * 255
- pmode = #none
- pCount = 0
- pDur = pDur + 1
- add(the actorList, me)
- end
-
- on endSprite me
- deleteOne(the actorList, me)
- end
-
- on mouseEnter me
- pCount = 1
- pmode = #on
- end
-
- on mouseLeave me
- pCount = 1
- pmode = #off
- end
-
- on getBehaviorDescription
- dMsg = EMPTY
- dMsg = dMsg & "Apply to a sprite and set the initial and ending opacity value." & RETURN
- dMsg = dMsg & "On a rollover the sprite will change opacity to the ending value." & RETURN
- dMsg = dMsg & "On a mouseleave the sprite will return to the beginning opacity."
- return dMsg
- end
-
- on getPropertyDescriptionList
- pList = [:]
- addProp(pList, #pBegin, [#comment: "Beginning fade value (0-100%): ", #format: #integer, #default: 0])
- addProp(pList, #pEnd, [#comment: "End fade value (0-100%): ", #format: #integer, #default: 100])
- addProp(pList, #pDur, [#comment: "Duration (Frames):", #format: #integer, #default: 10])
- return pList
- end
-
- on stepFrame me
- if pmode = #none then
- exit
- end if
- if pmode = #on then
- if pCount < pDur then
- dBlend = float(pCount) / pDur * pEnd
- sprite(spriteNum).blendLevel = dBlend
- pCount = pCount + 1
- else
- if sprite(spriteNum).blendLevel <> pEnd then
- sprite(spriteNum).blendLevel = pEnd
- pCount = pCount + 1
- end if
- end if
- else
- if pmode = #off then
- if pCount < pDur then
- dBlend = 255 - (float(pCount) / pDur * pEnd)
- sprite(spriteNum).blendLevel = dBlend
- pCount = pCount + 1
- end if
- end if
- end if
- end
-